<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>培训报名</title>
</head>
<body style="background: white"></body>
<script type="text/javascript" src="../../script/requestTool.js"></script>
<script src="../../script/utils/payUtils.js"></script>
<script src="../../script/manager/promptManager.js"></script>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript">
    var params;
    var pay_type;
    apiready=function () {
        api.openFrame({
            name : 'hotNews_frame',
            url : api.pageParam.train_type===4?'signup-list2.html':'signup-list1.html',
            rect : {
                x : 0,
                y : 0,
                w : 'auto',
                h : api.winHeight
            },
            bounces : false,
            pageParam : api.pageParam
        });
        api.addEventListener({
            name:'win_signup_train'
        },function (ret,arr) {
            params=ret.value;
            pay_type=ret.value.pay_type;
            request_signup();
        })
    };
    function request_signup() {
        showPromptDialog();
        cfnetppPOST(url_train_signup, params, false, function(data, status){
            hidePromptDialog();
            if (status == 'success') {
                if (data.code == 200) {
                    pay(pay_type,api.pageParam.payId);
                }else if(data.code == 102){
                    api.toast({
                        msg: '已报名'
                    });
                }else{
                    api.toast({
                        msg: '报名失败'
                    });
                }
            }else{
                api.toast({
                    msg: '网络异常请重试'
                });
            }
        });
    }
</script>
</html>